const TROUTES = [{
		key: "index",
		path: "/pages/index/index"
	},
	{
		key: "my",
		path: "/pages/my/my"
	}
]

const state = {
	userId: "",
	userInfo: null,
	token: '',
	wechatUser: null,
	openid: '',
	perfect: false,
	routes: [],
	tabbarRoutes: TROUTES,
	roles: []
};
const mutations = {
	SET_ROLES(state, data) {
		state.roles = data;
	},
	SET_USERID(state, data) {
		state.userId = data;
	},
	SET_ROUTES(state, data) {
		console.log("格式化后的路由",data);
		state.routes = data;
	},
	SET_PERFECT(state, data) {
		state.perfect = data;
	},
	INIT_USER(state, data) {
		state.userId = "";
		state.userInfo = null;
		state.token = '';
		state.wechatUser = null;
		state.openid = '';
		state.perfect = false;
		state.routes = [];
		state.tabbarRoutes = TROUTES;
		state.roles = [];
	},
	SET_USER(state, data) {
		state.userInfo = data;
	},
	SET_TOKEN(state, token) {
		// state.token = 'Bearer ' + token;
		state.token = token;
	},
	SET_WECHAT_USER(state, wechatUser) {
		state.wechatUser = wechatUser
	},
	SET_OPENID(state, openid) {
		state.openid = openid;
	}
};
const actions = {

};
const getters = {

};

export default {
	namespaced: true,
	state,
	mutations,
	actions,
	getters
}